<template>
	<div class="ordertui">
		<div id="kong">
			<img class="kong-img" src="../../img-shopping/pic@2x.png"/>
			<p class="kong-p">这里没有任何商品呢</p>
			<div @click="zhuye()" class="kong-b"><span class="kong-btn">去首页</span></div>
		</div>
		<div class="shopcard-listBox" v-for="item in orderlist">
			<h3 class="shopcard-title"><i><img src="../../img-shopping/icon_dianpu@3x.png"/></i><span>{{item.store_name}}</span>
				<span class="order-goods-stute" v-if="item.status&&!(item.status=='SUCCESS')&&!(item.status=='CLOSED')">退款中</span>
				<span class="order-goods-stutet" v-if="item.status&&item.status=='SUCCESS'">退款成功</span>
				<span class="order-goods-stute" v-if="item.status&&item.status=='CLOSED'">退款关闭</span>
			</h3>
			<ul class="shopcard-list-item-box">
				<li class="shopcard-list-item">
					<div>
						<img :src="'http://www.ntyouxuan.com/'+item.goods_image"/>
						<div class="shopcard-list-item-xinxi">
							<h3>{{item.goods_name}}</h3>
							<p><span>{{item.specification}}</span></p>
							<div class="shopcard-item-num">
								<span>￥</span>
								<span>{{item.price_detail[0]}}.</span>
								<span>{{item.price_detail[1]}}</span>
								<p class="shopDd-itemnum">x{{item.quantity}}</p>
							</div>
						</div>
					</div>
				</li>	
			</ul>
			<div class="refundshouh-list-footer">
				<span>退款金额</span>
				<span>￥26.90</span>
				<router-link :to="{path:'/myorder/refundxq',query:{'refundid':item.refund_id}}">查看详情</router-link>
			</div>
		</div>
	</div>
</template>

<script>
	
	export default{
		name:'orderfa',
		data () {
			return{
				user:0,
				orderpage:1,
				orderlist:[],
				scrollstatu:true,
				pagenum:0
			}
		},
		created:function(){
			this.user=localStorage.getItem("nt_user");
			var self=this;
			this.ajaxorder();
		},
		methods:{
			ajaxorder:function(){
				var self=this;
				$.ajax({
					type:"post",
					url:furl+"index.php?app=ajax_refund&act=index",
					data:{'token':self.user,'page':self.orderpage},
					dataType:'json',
					success:function(res){
						self.orderlist=self.orderlist.concat(res.retval.refunds);
						self.pagenum=res.retval.page.page_count;
						self.pdshuliang = res.retval.page.item_count;
						if (self.pdshuliang != 0) {
							$("#kong").hide()
						}else{
							$("#kong").show()
						}
					}
				});
			},
			zhuye: function() {
				window.location.href = 'http://www.ntyouxuan.com/newnt/#/';
			},
			scrollajax:function(){
				if(this.scrollstatu){
					if(this.orderpage+1<=this.pagenum){
						var dSH=$(document).scrollTop()
						var dH=$(document).height()
						var wH=$(window).height()
						if((dSH+wH)/dH>0.8){
							this.scrollstatu=false;
							this.orderpage=this.orderpage+1;
							console.log(this.orderpage);
							this.ajaxorder();
						}
					}
					
				}
			}
		},
		mounted:function(){
			var self=this;
			window.addEventListener("scroll",self.scrollajax);
		},
		destroyed:function () {
		    this.scrollstatu = false;
		}
		
	}
</script>

<style>
	.ordertui{font-size:0;}
	.ordertui .shopcard-listBox{
		margin-top: 0.2rem;
	}
	.ordertui .shopcard-listBox .order-goods-stute{
		float:right;
		font-size:0.28rem;
		color:#EE4846;
		font-weight:500;
	}
	.refundshouh-list-footer{
		height:0.98rem;
	}
	.refundshouh-list-footer>span{
		font-size:0.28rem;
		color:#2B2B2B;
		line-height: 0.98rem;
	}
	.refundshouh-list-footer>span:nth-child(2){
		font-size:0.3rem;
		color:#EE4846;
	}
	.refundshouh-list-footer>a{
		float:right;
		display: inline-block;
		width:1.74rem;
		height:0.5rem;
		text-align: center;
		line-height: 0.5rem;
		margin-top: 0.24rem;
		box-sizing: border-box;
		border:1px solid #999;
		border-radius:0.5rem;
		font-size:0.28rem;
		color:#666;
	}
	#kong{
		text-align: center;
		margin: 0 auto;
		margin-top: 2.2rem;
	}
	#kong img{
		width: 3.6rem;
		height: 3.2rem;
	}
	#kong .kong-p{
		font-size: 0.32rem;
		color: #999999;
		margin-top: 0.84rem;
	}
	#kong .kong-b{
		width: 1.8rem;
		height: 0.7rem;
		border:1px solid #5DB440;
		margin-left:2.85rem;
		margin-top: 0.44rem;
		border-radius: 0.35rem;
	}
	#kong .kong-btn{
		font-size: 0.33rem;
		color: #5DB440;
		line-height: 0.7rem;
	}
</style>